package com.stone.serviceimpl;

import java.util.List;

import com.stone.dao.IRankDao;
import com.stone.model.Rank;
import com.stone.service.IRankService;

public class RankService implements IRankService {

	private IRankDao rankDao;

	public IRankDao getRankDao() {
		return rankDao;
	}

	public void setRankDao(IRankDao rankDao) {
		this.rankDao = rankDao;
	}

	public Rank findRankByType(String type) {
		List<Rank> list = rankDao.findByProperty("type", type);
		if (list.size() == 0) {
			return null;
		} else {
			return list.get(0);
		}
	}

	public void updateRank(Rank rank) {
		rankDao.update(rank);
	}
	
	public void addRank(Rank rank) {
		rankDao.save(rank);
	}
}
